package com.wuxiaofan.api;

import com.wuxiaofan.entity.User;
import com.wuxiaofan.service.UserService;
import com.wuxiaofan.vo.ReturnResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@RestController
@Slf4j
public class LoginApi {

    @Resource
    private UserService userService;

    @RequestMapping("login")
    public ReturnResult login(User user, HttpServletRequest request, HttpServletResponse response) {
        log.info("user:{}", user);
        return userService.login(user, request, response);
    }
}
